#define _CRT_SECURE_NO_WARNINGS 1
#include <cmath>
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include<math.h>
#include<stdlib.h>
#include<stdio.h>
using namespace std;

class Solution {
public:
    vector<int> productExceptSelf(vector<int>& nums) {
        int n = nums.size();
        vector<int> arr(n + 1, 1);
        vector<int> brr(n + 1, 1);
        for (int i = 0; i < n; i++)
        {
            if (i == 0) arr[i] = 1;
            else arr[i] = arr[i - 1] * nums[i - 1];
        }
        for (int i = n - 1; i >= 0; i--)
        {
            if (i == n - 1) brr[i] = 1;
            else brr[i] = nums[i + 1] * brr[i + 1];
        }
        vector<int> ret(n, 0);
        for (int i = 0; i < n; i++)
        {
            ret[i] = arr[i] * brr[i];
        }
        return ret;
    }
};

int main() {
    return 0;
}